package com.ycxy.springsecuritycourse.controller;


import com.ycxy.springsecuritycourse.entity.AjaxResult;
import com.ycxy.springsecuritycourse.entity.Users;
import com.ycxy.springsecuritycourse.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;
    @PostMapping ("/login")
    public AjaxResult login(@RequestBody Users users) throws Exception {
        String token=loginService.login(users);
        return AjaxResult.success(token);
    }
}
